package com.saclub.app.fragment;

import android.app.Activity;
import android.widget.TextView;
import butterknife.Bind;
import butterknife.OnClick;

import com.loopj.android.http.RequestParams;
import com.saclub.app.R;
import com.saclub.app.activity.MyToolBarActivity;
import com.saclub.app.common.MyPageHelper;
import com.saclub.app.http.ApiRequest;

public class AccountLoginFragment extends BaseProgressFragment<MyToolBarActivity> {

	@Bind(R.id.id_user_login_mail)
	protected TextView mailText;

	@Bind(R.id.id_user_login_pwd)
	protected TextView pwdText;

	@Override
	protected int obtainContentRes() {
		return R.layout.frag_account_login;
	}

	@Override
	protected void initParams() {

	}

	@Override
	protected void initView() {

	}

	@Override
	protected void initData() {

	}
	
	@OnClick(R.id.id_user_login_btn)
	public void doLogin(){
		
		String mail = mailText.getText().toString();
		String pwd = pwdText.getText().toString();
		
		RequestParams params = new RequestParams();
		params.put("email", mail);
		params.put("pass", pwd);
		
		ApiRequest.userLogin.request(this, params);
	}
	
	public TextView getMailText() {
		return mailText;
	}

	public TextView getPwdText() {
		return pwdText;
	}

	public static void go(Activity act) {
		MyPageHelper.accountLogin.showMyPage(act);
	}

}
